package javatuning.ch4.future.jdk;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

public class CompletableFutureMain {
    public static void main(String[] args) throws InterruptedException, ExecutionException {
        CompletableFuture.supplyAsync(()->{
        	try {
        	    return new RealData("a").call();
			} catch (Exception e) {
				return "";
			} 
        }).whenComplete((r,e)->{
        	System.out.println("simulate insert to db:" + r);
        }).get();
    }
}
